//
//  commTableViewCell.m
//  YiXiu
//
//  Created by yixiu on 16/7/22.
//  Copyright © 2016年 zzz. All rights reserved.
//





#import "commTableViewCell.h"
#import "commModel.h"

@interface commTableViewCell ()

//用户人头像
@property(nonatomic, strong) UIImageView * iconImage;
//昵称
@property(nonatomic, strong) UILabel * nameLabel;
//热度的按钮
@property(nonatomic, strong) UIButton * hotBut;
//文字信息
@property(nonatomic, strong) UILabel * contentLabel;
//图片
@property(nonatomic, strong) UIView * contentImages;
//点赞的按钮
@property(nonatomic, strong) UIButton * zangBut;
//评论
@property(nonatomic, strong) UIButton * pinLunBtn;
//分享
@property(nonatomic, strong) UIButton * fenXianBtn;
//收藏
@property(nonatomic, strong) UIButton * souCanBtn;
//尾视图
@property (nonatomic, strong) UIView * footView;


@end






@implementation commTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
- (instancetype)initWithTableView:(UITableView *)tableView
{
    static NSString * identf = @"cell";
    self = [tableView dequeueReusableCellWithIdentifier:identf];
    
    if (!self) {
        self = [[commTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identf];
        
        self.selectionStyle = UITableViewCellSelectionStyleNone;
//        [self addHeadView];
//        [self addBodyView];
//        [self addFooterView];
    }
    
    return self;
}

- (void)addHeadView{
    
    UIView * HeadView = [[UIView alloc] initWithFrame:CGRectMake(0, 10, WidthOfView([UIScreen mainScreen]), 60)];
    [self addSubview:HeadView];
    
    UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(iconTapAction:)];
    
    UITapGestureRecognizer * tap1 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(iconTapAction:)];
    
    
    UIImageView * imageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 0, 60, 60)];
    imageView.layer.cornerRadius = 30;
    imageView.backgroundColor = [UIColor greenColor];
    imageView.userInteractionEnabled = YES;
    
    UILabel * label = [[UILabel alloc] initWithFrame:CGRectMake(90, 15, 120, 30)];
    label.userInteractionEnabled = YES;
    [imageView addGestureRecognizer:tap];
    [label addGestureRecognizer:tap1];
    
    
    UIButton * hot = [[UIButton alloc] initWithFrame:CGRectMake(WidthOfView([UIScreen mainScreen]) - 90, 15, 80, 30)];
    [hot setImage:[UIImage imageNamed:@"pt"] forState:UIControlStateNormal];
    hot.userInteractionEnabled = NO;
    
    
    
    
    self.iconImage = imageView;
    self.nameLabel = label;
    self.hotBut = hot;
    
    [HeadView addSubview:imageView];
    [HeadView addSubview:label];
    [HeadView addSubview:hot];
}

- (void)addBodyView{
    
    UIView * bodyView = [[UIView alloc] initWithFrame:CGRectMake(0, 80, WidthOfView([UIScreen mainScreen]), 130)];
    [self addSubview:bodyView];
    
    UILabel * label = [[UILabel alloc] initWithFrame:CGRectMake(10, 0, WidthOfView([UIScreen mainScreen]) - 20, 60)];
    label.numberOfLines = 0;
    //    label.backgroundColor = [UIColor grayColor];
    [bodyView addSubview:label];
    self.contentLabel = label;
    
    
    UIView * imagesview = [[UIView alloc] initWithFrame:CGRectMake(10, 70,WidthOfView([UIScreen mainScreen]) - 20, 60)];
    //    imagesview.backgroundColor = [UIColor greenColor];
    [bodyView addSubview:imagesview];
    self.contentImages = imagesview;
    
    
}

- (void)addFooterView{
    
    UIView * footView = [[UIView alloc] initWithFrame:CGRectMake(WidthOfView([UIScreen mainScreen]) - 250 - 20, 230, 250, 40)];
    [self addSubview:footView];
    
    
    UIButton * button1 = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 69, 30)];
    
    [button1 setImage:[UIImage imageNamed:@"icon_n1"] forState:UIControlStateNormal];
    
    
    UIButton * button2 = [[UIButton alloc] initWithFrame:CGRectMake(70, 0, 69, 30)];
    
    [button2 setImage:[UIImage imageNamed:@"icon_n2"] forState:UIControlStateNormal];
    
    UIButton * button3 = [[UIButton alloc] initWithFrame:CGRectMake(140, 0, 69, 30)];
    
    [button3 setImage:[UIImage imageNamed:@"icon_n3"] forState:UIControlStateNormal];
    
    UIButton * button4 = [[UIButton alloc] initWithFrame:CGRectMake(210, 0, 30, 30)];
    
    [button4 setImage:[UIImage imageNamed:@"icon_n4"] forState:UIControlStateNormal];
    
    
    self.zangBut = button1;
    self.pinLunBtn = button2;
    self.fenXianBtn = button3;
    self.souCanBtn = button4;
    
    [footView addSubview:button1];
    [footView addSubview:button2];
    [footView addSubview:button3];
    [footView addSubview:button4];
    
    self.footView = footView;
}




- (void)addImages:(NSArray *)images{
    
    NSLog(@"%s",__func__);
    
    
}



#pragma mark - Action
- (void)iconTapAction:(UITapGestureRecognizer *)tap{
//    self.iconBlock();
}


-(void)textTapAction:(UITapGestureRecognizer *)tap{
    
//    self.textBlock();
    
}








@end
